In JSP, the standard simplifies the development of the tag library. To enable custom tags in JSP2, you only need to perform the following three steps:I. Development of custom tag processing class2. Create a *. tld File3. Use custom tags in JSP filesThe
Categories of JSP Tags:1) built-in label (action tag): No need to import tags on JSP page2) Jstl Tags: need to import tags in JSP pages3) Custom Tags: developer self-defined, need to import ta
1. Create a new tag named name. TLD. Note that this file should be placed under the WEB-INF file (same as Web. XML) and will be automatically loaded at runtime
2. Now we start to implement the getname method of the tag. Create a new package com. yuqiaotech. PMS. webapp. tags, which contains two files: getname. Java and pmstag. java.
Getname. Java
Package COM. yuqiaotech. PMS. webapp. tags; import javax.
JSP implementation is used to automatically generate form tags. html code custom form tags are automatically generated by jsp.
This example describes how to use JSP to automatically generate custom form tags for form tags html cod
The last time the use of custom tags to solve the relevant code into the corresponding Chinese meaning of the requirements, the effect is good, tasted the sweetness of the custom label, ready to be some drop-down menu optimization using a custom tag to achieve.
1, JSP page:
2, according to the page
Servlet custom tag development steps, servlet custom tags1. Why do I need to use custom tags?(1) integrated with JSP pages(2) It also has certain business logic functions, such as loops and CIDR blocks...
(3) Replace
2. Step 3 of custom tag development ):
(1) customize a ta
When developing custom tags in JSF, the setting of the id attribute value is not the same as the general properties:
if (this.id!=null) {
Component.setvalueexpression ("id", this.id);
}
If this setting runs, the java.lang.IllegalArgumentException exception is reported because the expression name is detected in the setvalueexpression side of the UIComponent class as "id" or " Parent "throws a Java.lang.Ille
classes;
Create a *.tld file, each *.tld file corresponding to a tag library, each tag library corresponding to multiple tags;
Use custom labels in your JSP files.
Developing Custom Label Classes
Tag Library and actual development
Tag libraries are a very important technology, and often beginners and ordinary developers have little chance of developing thei
1. Overview of custom JSP labels
A custom JSP tag is a type of JSP tag defined by the programmer. This tag encapsulates the information display logic in a separate Java class and describes its usage through an XML file. When you need to use similar display logic in the page, you can insert this label in the page to complete the corresponding functions. Custom
Getting started with JSP custom tags,
This article shares with you the tutorials on getting started with JSP custom tags.
1. JSP custom tag:
Custom tags are
Custom tags for getting started with JSP
The second part is a brief explanation: It mainly describes el expressions and core tag libraries. This chapter describes how to configure custom tag libraries, 404 pages, 505 pages, and error pages.
Download all code: Link1. JSP custom tag:
I. Basic concepts:
1. Tag ):
A tag is an XML element. A tag can simplify and maintain a JSP webpage, and supports multiple language versions for the same JSP file. Because tags are XML elements, their names and attributes are case sensitive.
2. Tag Library ):
A set of tags that have similar functions and are logically associated with each other is called a tag library.
3. Tag library description file (TAG l
Dubbo to better integrate with spring, it provides some XML configuration tags, which are custom labelsSpring Custom LabelsSpring customizes the labels in the following ways:
Design Configuration Properties and JavaBean
Write XSD files, validate XML attributes, and facilitate editor hints
Write Namespacehandler and Beandefinitionparser to parse X
In Web application development with the Spring MVC framework, we will use custom tags to perform some special functions under special requests.
In general, the content of a custom label can be implemented without accessing the service, so inheriting tagsupport, overriding the doStartTag () method, enables basic functionality.
eg. A
Custom tags are mainly used to remove java code from Jsp pages.Execution Process of custom JSP labelsWhen a JSP page containing custom tags is translated into Servlet by the JSP Engine (Web Container), the JSP Engine encounters custom
JSP custom tags can be used in the main two packagesjavax.servlet.jsp.*;javax.servlet.jsp.tagext.*;Customize the label As followsDefine user-tired User.java get set is not in the repeating.Private String UserName;Private Integer age;Private String Email;Public User () {This.username= "Zhang San";this.email= "[email protected]";this.age=28;}Create a custom Label c
Introduction: When you reference more interactivity in a custom tag, you also increase the likelihood of error occurrence, especially if the error occurs as an illegal argument. In this issue of JSP best practices, Brett McLaughlin shows you how to capture and ignore illegalargumentexception exceptions in your source code.
As we discuss JSP custom tags, we have
contain ASP code for server resolution. The ASP code looks like an HTML tag, which is labeled by a pair of tags, starting with the
Note: This section explains how to define how Dreamweaver displays a custom label, but does not describe how to edit the contents or attributes of a custom label. How to create a property inspector to check and modify the properties
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.